Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Namespace Support #29

Conversation

sp-sophia-labs
Copy link

Description

The goal of this PR is to enable namespaces for the turtlebot4 robot to be able to spawn multiple instances in the same simulation space without resorting to isolated networks

Type of change: new feature. This change does not fix any open issue

How has this been tested?

We have created a project with dependencies pointing to specific commits (submodules) here: https://github.com/sp-sophia-labs/turtlebot4_multi_sim (details in the dependency section below). Reviewers may clone the project and replicate exactly what we use for testing. You can follow the readme from the project or use the following:

Launch the world and the first turtlebot4 instance:
ros2 launch turtlebot4_ignition_bringup ignition.launch.py namespace:=robot_0 robot_name:=robot_zero

Alternatively, launching the robot without namespaces is still available:
ros2 launch turtlebot4_ignition_bringup ignition.launch.py

In a separate terminal, spawn another turtlebot4 instance with different name, namespace and pose:
ros2 launch turtlebot4_ignition_bringup turtlebot4_spawn.launch.py namespace:=robot_1 robot_name:=robot_one y:=1
You can change the x, y, z, and yaw params to spawn the robot where needed

Once the gazebo simulation has started, you can modify the TurtleBot4 HMI field to reflect on the new robot name. It defaults to "turtlebot4"
This will correctly map the Turtlebot4's simulated interface to one of your robots

Dependencies

We have modified other packages outside of turtlebot4_simulator to be able to spawn multiple turtlebot4 in simulation with namespaces. Here is the list with a short description of the reasons for the changes:

We'll update the dependencies above according to PR and release status

Known Issues

While topics, nodes and frames look good with namespaces, navigation2 still refuses to work properly with namespaces. We are still trying to figure out the correct configuration for the amcl node (cf. https://github.com/sp-sophia-labs/turtlebot4/blob/feat/turtlebot4_namespace/turtlebot4_navigation/config/nav2.yaml). Help would be appreciated

Checklist

  • Resolve Create3_sim PR and its dependencies
  • Test namespaces on Gazebo classic (will probably require some work)
  • Evaluate if "robot_name"(ignition/gazebo name) should be the same as the namespace
  • Find a more elegant solution to the duplicate namespace entries in launch files
  • Resolve navigation2 issues

@sp-sophia-labs sp-sophia-labs marked this pull request as draft November 29, 2022 18:24
@roni-kreinin
Copy link
Contributor

@sp-sophia-labs Have you tried using PushRosNamespace with a GroupAction rather than having a namespaced version of nodes? This should be a much simpler change than manually adding the namespace for each node.

See https://github.com/ros-planning/navigation2/blob/main/nav2_bringup/launch/bringup_launch.py#:~:text=bringup_cmd_group%20%3D%20GroupAction,%3Dnamespace)%2C for an example.

@sp-sophia-labs
Copy link
Author

sp-sophia-labs commented Nov 29, 2022

@roni-kreinin I've seen this while trying to make navigation2 work with namespaces. I haven't tried this yet for the rest of the code but it's definitely a more elegant solution to the entry duplication that we have right now. I'll try it out once I'm done with the navigation issues

@roni-kreinin
Copy link
Contributor

Closing this as #35 is now merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants